<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:c="http://java.sun.com/jstl/core"
      xmlns:s="http://jboss.com/products/seam/taglib"
      xmlns:a="http://richfaces.org/a4j"
      xmlns:r="http://richfaces.org/rich"
      xmlns:m="http://www.caradvert.com/main">

<ui:composition template="/content/templates/mainTemplate.xhtml">
    <ui:param name="selectedMenu" value="sell"/>
    <ui:param name="advertType" value="#{viewAdvertsBean.advertType}"/>
    <ui:param name="productType" value="#{viewAdvertsBean.productType}"/>
    <ui:param name="vehicleType" value="#{viewAdvertsBean.vehicleType}"/>
    <ui:param name="vehicleCategory" value="#{viewAdvertsBean.vehicleCategory}"/>
    
    <ui:define name="title">#{labels['SELLING_PAGE']}</ui:define>
    <ui:define name="body">
        <ui:decorate template="/content/templates/contentDecorator.xhtml">

            <ui:repeat value="#{viewAdvertsBean.adverts}" var="advert">
                <ui:include src="/content/components/previewAdvertComponent.xhtml">
                    <ui:param name="advert" value="#{advert}"/>
                    <ui:param name="advertDetailsPage" value="/content/pages/sell/viewAdvertDetails.xhtml"/>
                </ui:include>
                <div style="height:5px;">&#160;</div>
            </ui:repeat>

            <h:panelGroup rendered="#{viewAdvertsBean.adverts.size() gt 0}">
                <ui:include src="/content/panels/advertsNavigationPanel.xhtml">
                    <ui:param name="pageAwareBean" value="#{viewAdvertsBean}"/>
                    <ui:param name="parentPage" value="/content/pages/sell/viewAdverts.xhtml"/>
                    <ui:param name="criteria" value="advert-type=#{viewAdvertsBean.advertType}"/>
                </ui:include>
            </h:panelGroup>
            <h:panelGroup layout="block" rendered="#{viewAdvertsBean.adverts.size() eq 0}" style="margin-top:40px;">
                #{labels['NO_ADVERTS_YET']}
            </h:panelGroup>
            
        </ui:decorate>
    </ui:define>
</ui:composition>
</html>